﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ORS.Web
{
    public partial class ReviewHandle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                
                if (Request.QueryString["paperid"] != null)
                {
                    string reviewname = HttpContext.Current.Session["reviewerid"].ToString();
                    string pid = Request.QueryString["paperid"].ToString();
                    ORS.BLL.processopr pro = new ORS.BLL.processopr();
                    pro.GetPaperInfo(pid);
                    tbx_title.Text = pro.TITLE;
                    tbx_cname.Text = pro.AUTHOR;
                    tbx_interest.Text = pro.interest_field;
                    tbx_desc.Text = pro.DESCRIPTION;
                    hl_paper.Text ="<a href=\""+ pro.CONTENTLINK + "\">文件下载</a>";
                }
                else
                {
                    Response.Write("论文ID数据不存在！");
                }
            }
            
        }

        protected void btnreview_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["paperid"].ToString();
            string reviewname = HttpContext.Current.Session["reviewerid"].ToString();
            string reviewer = new ORS.BLL.SearchName().getUsername(reviewname);
            int rstate = int.Parse(rbtn_appove.SelectedItem.Value);
            
            ORS.BLL.processopr pro = new ORS.BLL.processopr();
            pro.PaperReview(pid,rstate,1);

            ORS.BLL.reviewhandle rhandle = new ORS.BLL.reviewhandle();
            rhandle.Paperid = int.Parse(pid);
            rhandle.Reviewstate = rstate;
            rhandle.Reviewcomm = tbx_paper.Text;
            rhandle.Reviewer = reviewer;
            rhandle.setReviewHistory();

            //Response.Write("<script language=javascript>window.parent.location.href=\"Review_Mainpage.aspx\";</script>");
            Review_Mainpage frm = new Review_Mainpage();
            
            Response.Redirect("~/Review.aspx");            
        }
    }
}